package com.chuangjiangx.member.score.ddd.domain.model;

/**
 * 积分明细的积分类型
 * @author cj-ch
 */
public enum MbrScoreType {
    /**
     * 消费累计
     */
    CONSUMER("消费", (byte) 1),
    /**
     * 兑换扣除
     */
    EXCHANGE("兑换", (byte) 2),
    /**
     * 退款扣除
     */
    REFUND("退款", (byte) 3),
    /**
     * 充值赠送
     */
    GIFT("充值赠送", (byte) 4),
    //(废弃)其他支付消费
    @Deprecated
    OTHER_CONSUMPTION("消费", (byte) 5),
    /**
     * 开卡赠送
     */
    CARD_GIFT("开卡赠送",(byte)6);



    public final String name;
    public final byte value;

    MbrScoreType(String name, byte value) {
        this.name = name;
        this.value = value;
    }

    public static MbrScoreType getScoreType(byte value) {
        for (MbrScoreType mbrScoreType : MbrScoreType.values()) {
            if (mbrScoreType.value == value) {
                return mbrScoreType;
            }
        }
        return null;
    }
}
